<?php

App::uses('AppController', 'Controller');

/**
 * Groups Controller
 *
 * @property Group $Group
 */
class CiediesController extends AppController {

    public $layout = 'hospital';
    public $uses = array('Ciede');

    public function beforeFilter() {
        parent::beforeFilter();
        //$this->Auth->allow();
    }

    public function regulariza() {
        $cies = $this->Migracie10->find('all', array(
            'recursive' => -1,
            'conditions' => array('Migracie10.id >' => 656)
        ));
        //debug($cies);
        foreach ($cies as $d) {
            $codigoTres = $d['Migracie10']['descod3'];
            $idCodigo = $d['Migracie10']['id'];
            //$varAux = $codigoTres;

            if (!empty($codigoTres)) {
                $varAux = $codigoTres;
                //$data = array('id'=>$idCodigo, 'cod3'=>$varAux);
                //debug($varAux);
                //$this->Migracie10->save($varAux);
            } else {
                //debug($codigoTres);
                $data = array('id' => $idCodigo, 'descod3' => $varAux);
                //debug($data);
                $this->Migracie10->save($data);
            }
        }
        //debug($cies);
        $this->set(compact('cies'));
    }   

}